@extends('admin.layouts.layout')
@section('content')
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox-title">
                <h5>玩家收支统计</h5>
            </div>
            <div class="ibox-content">
                <form class="form-horizontal " action="{{route('pay.trade')}}" method="post"
                      enctype="multipart/form-data">
                    {!! csrf_field() !!}
                    <table class="table-striped table-bordered table-hover table-condensed">
                        <tr class="b-group">
                            <td class="b-child" colspan="2">
                                <table class="table-striped table-bordered table-hover table-condensed">
                                    <tr class="b-group">
                                        <td>
                                            @include('widget.between_datetime',['showEndTime'=>true])
                                        </td>
                                        <td>
                                            <div class="form-inline">
                                                @include('widget.query_and_refresh')
                                            </div>
                                        </td>
                                        <td>
                                            <div class="form-inline m-l-xs">
                                                <label class="control-label">数量</label>
                                                <div class="input-daterange input-group">
                                                    <input autocomplete="off" type="text"
                                                           oninput="value=value.replace(/[^\d]/g,'')"
                                                           class="input-sm form-control"
                                                           name="amount_from"
                                                           value="{{app('request')->input('amount_from')}}"/>
                                                    <span class="input-group-addon">到</span>
                                                    <input autocomplete="off" oninput="value=value.replace(/[^\d]/g,'')"
                                                           type="text" class="input-sm form-control"
                                                           name="amount_to"
                                                           value="{{app('request')->input('amount_to')}}"/>
                                                </div>
                                                @if ($errors->has('amount_from'))
                                                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('amount_from')}}</span>
                                                @endif
                                                @if ($errors->has('amount_to'))
                                                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('amount_from')}}</span>
                                                @endif
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr class="b-group">
                            <td class="b-child" colspan="2">
                                <table class="table-striped table-bordered table-hover table-condensed">
                                    <tr class="b-group">
                                        <td>
                                            <div class="form-inline">
                                                <label class="control-label">账号</label>
                                                <input autocomplete="off" type="text" class="input-sm form-control"
                                                       name="account"
                                                       value="{{app('request')->input('account')}}"/>
                                                @if ($errors->has('account'))
                                                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('account')}}</span>
                                                @endif
                                            </div>
                                        </td>
                                        <td>
                                            <div class="form-inline">
                                                <label class="control-label">角色昵称</label>
                                                <div class="input-daterange input-group">
                                                    <input autocomplete="off" type="text" class="input-sm form-control"
                                                           name="nickname"
                                                           value="{{app('request')->input('nickname')}}"/>
                                                </div>
                                                @if ($errors->has('nickname'))
                                                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('nickname')}}</span>
                                                @endif
                                            </div>
                                        </td>
                                        <td>
                                            <div class="form-inline">
                                                <label class="control-label">角色ID</label>
                                                <div class="input-daterange input-group">
                                                    <input autocomplete="off" type="text" class="input-sm form-control"
                                                           name="uid"
                                                           value="{{app('request')->input('uid')}}"/>
                                                </div>
                                                @if ($errors->has('uid'))
                                                    <span class="help-block m-b-none"><i class="fa fa-info-circle"></i>{{$errors->first('uid')}}</span>
                                                @endif
                                            </div>
                                        </td>
                                        <td>
                                            <div class="form-inline">
                                                <label class="control-label">收支类型</label>
                                                <div class="input-daterange input-group">
                                                    <div class="radio i-checks">
                                                        <label>
                                                            <input type="radio"
                                                                   @if(app('request')->input('trade_type')==0)checked=""
                                                                   @endif value="0" name="trade_type">
                                                            <i></i> 全选</label>
                                                        <label>
                                                            <input type="radio"
                                                                   @if(app('request')->input('trade_type')==1)checked=""
                                                                   @endif value="1" name="trade_type"> <i></i>
                                                            收入</label>
                                                        <label>
                                                            <input type="radio"
                                                                   @if(app('request')->input('trade_type')==2)checked=""
                                                                   @endif value="2" name="trade_type"> <i></i>
                                                            支出</label>
                                                    </div>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr class="b-group">
                            <th width="10%">
                                <div class="form-inline">
                                    <label>全选/不选&nbsp;&nbsp;<input type="checkbox" checked="checked" value=""
                                               onclick="checkAll(this)"></label>
                                </div>
                            </th>
                            <td class="b-child">
                                <div style="max-height:6.5rem;overflow-y:scroll;">
                                    @include('widget.channel')
                                </div>
                            </td>
                        </tr>
                        <tr class="b-group">
                            <th width="10%">
                                <div class="form-inline">
                                    <label>全选/不选&nbsp;&nbsp;<input type="checkbox" checked="checked" value=""
                                               onclick="checkAll(this)"></label>
                                </div>
                            </th>
                            <td class="b-child">
                                <div style="max-height:10rem;overflow-y:scroll;">
                                    @include('widget.server')
                                </div>
                            </td>
                        </tr>
                    </table>
                    <input type="hidden" name="page_size" value="{{$reqPageSize}}"/>
                </form>
                <table class="table table-striped table-bordered table-hover m-t-md tblData">
                    <thead>
                    <tr>
                        <th class="text-center">渠道</th>
                        <th class="text-center">区服</th>
                        <th class="text-center">账号</th>
                        <th class="text-center">角色ID</th>
                        <th class="text-center">角色昵称</th>

                        <th class="text-center">收支类型</th>
                        <th class="text-center">货币</th>
                        <th class="text-center">累计更新数量</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($trade as $key => $item)
                        <tr>
                            <td>{{$item['channel_name']}}</td>
                            <td>{{$item['server_name']}}</td>
                            <td>{{$item['account']}}</td>
                            <td>{{$item['_id']->id}}</td>
                            <td>{{$item['nickname']}}</td>

                            <td>{{$item['trade_type_name']}}</td>
                            <td>{{$item['money_kinds_name']}}</td>
                            <td>{{$item['total_update_amount']}}</td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
                <div class="pull-left pagination m-t-no">
                    @include('widget.page',['reqPageSize'=>$reqPageSize])
                </div>
                <div class="pull-right pagination m-t-no">
                    <div class="text-center">
                        <?php
                        if (count($trade) > 0) {
                            echo $trade->appends(['start_time' => $reqStartTime,
                                'end_time' => $reqEndTime,
                                'channel_id' => $str_arr_channels_id,
                                'unique_id' => $str_arr_unique_id,
                                'trade_type' => app('request')->input('trade_type'),
                                'amount_from' => app('request')->input('amount_from'),
                                'amount_to' => app('request')->input('amount_to'),
                                'account' => app('request')->input('account'),
                                'nickname' => app('request')->input('nickname'),
                                'uid' => app('request')->input('uid'),
                                'page_size' => app('request')->input('page_size'),
                            ])->links();
                        }
                        ?>
                    </div>
                </div>
                <div class="clearfix"></div>
            </div>
        </div>
    </div>
    <script>
    </script>
    <link href="{{loadEdition('/admin/css/plugins/datapicker/bootstrap-datepicker.css')}}" rel="stylesheet">
@endsection
@section('js')
    <script src="{{loadEdition('/admin/js/plugins/datapicker/bootstrap-datepicker.js')}}"></script>
    <script src="{{loadEdition('/admin/js/plugins/datapicker/bootstrap-datepicker.zh-CN.js')}}"></script>
    <script src="{{loadEdition('/js/global.js')}}"></script>
@stop